<div xmlns:ext="http://www.extjs.com" class="body-wrap"><div class="inheritance res-block"><pre class="res-block-inner"><a href="output/Ext.Template.html" ext:member="" ext:cls="Ext.Template">Template</a>&#13;&nbsp;&nbsp;<img src="resources/elbow-end.gif">MasterTemplate</pre></div><h1>Class <a href="source/MasterTemplate.html#cls-Ext.MasterTemplate">Ext.MasterTemplate</a></h1><table cellspacing="0"><tr><td class="label">Package:</td><td class="hd-info">Ext</td></tr><tr><td class="label">Defined In:</td><td class="hd-info">MasterTemplate.js</td></tr><tr><td class="label">Class:</td><td class="hd-info"><a href="source/MasterTemplate.html#cls-Ext.MasterTemplate">MasterTemplate</a></td></tr><tr><td class="label">Extends:</td><td class="hd-info"><a href="output/Ext.Template.html" ext:cls="Ext.Template" ext:member="">Template</a></td></tr></table><div class="description">Provides a template that can have child templates. The syntax is:
<pre><code><b>var</b> t = <b>new</b> Ext.MasterTemplate(
	<em>'&lt;select name=<em>"{name}"</em>&gt;'</em>,
		<em>'&lt;tpl name=<em>"options"</em>&gt;&lt;option value=<em>"{value:trim}"</em>&gt;{text:ellipsis(10)}&lt;/option&gt;&lt;/tpl&gt;'</em>,
	<em>'&lt;/select&gt;'</em>
);
t.add(<em>'options'</em>, {value: <em>'foo'</em>, text: <em>'bar'</em>});
<i>// or you can add multiple child elements <b>in</b> one shot</i>
t.addAll(<em>'options'</em>, [
    {value: <em>'foo'</em>, text: <em>'bar'</em>},
    {value: <em>'foo2'</em>, text: <em>'bar2'</em>},
    {value: <em>'foo3'</em>, text: <em>'bar3'</em>}
]);
<i>// then append, applying the master template values</i>
t.append(<em>'my-form'</em>, {name: <em>'my-select'</em>});</code></pre>
A name attribute for the child template is not required if you have only one child
template or you want to refer to them by index.</div><div class="hr"></div><a id="Ext.MasterTemplate-props"></a><h2>Public Properties</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Property</th><th class="msource-header">Defined By</th></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-disableFormats"></a><b><a href="source/Template.html#prop-Ext.Template-disableFormats">disableFormats</a></b> : Boolean<div class="mdesc">True to disable format functions (defaults to false)</div></td><td class="msource"><a href="output/Ext.Template.html#disableFormats" ext:member="#disableFormats" ext:cls="Ext.Template">Template</a></td></tr><tr class="property-row  inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-re"></a><b><a href="source/Template.html#prop-Ext.Template-re">re</a></b> : RegExp<div class="mdesc">The regular expression used to match template variables</div></td><td class="msource"><a href="output/Ext.Template.html#re" ext:member="#re" ext:cls="Ext.Template">Template</a></td></tr><tr class="property-row  "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.MasterTemplate-subTemplateRe"></a><b><a href="source/MasterTemplate.html#prop-Ext.MasterTemplate-subTemplateRe">subTemplateRe</a></b> : RegExp<div class="mdesc">The regular expression used to match sub templates</div></td><td class="msource">MasterTemplate</td></tr></tbody></table><a id="Ext.MasterTemplate-methods"></a><h2>Public Methods</h2><table cellspacing="0" class="member-table"><tbody><tr><th colspan="2" class="sig-header">Method</th><th class="msource-header">Defined By</th></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.MasterTemplate-MasterTemplate.from"></a><b><a href="source/MasterTemplate.html#method-Ext.MasterTemplate-MasterTemplate.from">MasterTemplate.from</a></b>(&nbsp;<code>String/HTMLElement&nbsp;el</code>,&nbsp;<code>Object&nbsp;config</code>&nbsp;)
    :
                                        void<div class="mdesc"><div class="short">&lt;static&gt;&nbsp;Creates a template from the passed element's value (display:none textarea, preferred) or innerHTML. e.g.&#13;
var tpl = E...</div><div class="long">&lt;static&gt;&nbsp;Creates a template from the passed element's value (display:none textarea, preferred) or innerHTML. e.g.
var tpl = Ext.MasterTemplate.from('element-id');<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>el</code> : String/HTMLElement<div class="sub-desc"></div></li><li><code>config</code> : Object<div class="sub-desc"></div></li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">MasterTemplate</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.MasterTemplate-add"></a><b><a href="source/MasterTemplate.html#method-Ext.MasterTemplate-add">add</a></b>(&nbsp;<span title="Optional" class="optional">[<code>String/Number&nbsp;name</code>]</span>,&nbsp;<code>Array/Object&nbsp;values</code>&nbsp;)
    :
                                        MasterTemplate<div class="mdesc"><div class="short">Applies the passed values to a child template.</div><div class="long">Applies the passed values to a child template.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>name</code> : String/Number<div class="sub-desc">(optional) The name or index of the child template</div></li><li><code>values</code> : Array/Object<div class="sub-desc">The values to be applied to the template</div></li></ul><strong>Returns:</strong><ul><li><code>MasterTemplate</code><div class="sub-desc">this</div></li></ul></div></div></div></td><td class="msource">MasterTemplate</td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.MasterTemplate-addAll"></a><b><a href="source/MasterTemplate.html#method-Ext.MasterTemplate-addAll">addAll</a></b>()
    :
                                        void<div class="mdesc"><div class="short">Alias for fill().</div><div class="long">Alias for fill().<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource">MasterTemplate</td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-append"></a><b><a href="source/Template.html#method-Ext.Template-append">append</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
    :
                                        HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and appends the new node(s) to el.</div><div class="long">Applies the supplied values to the template and appends the new node(s) to el.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li></ul><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#append" ext:member="#append" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-apply"></a><b><a href="source/Template.html#method-Ext.Template-apply">apply</a></b>()
    :
                                        void<div class="mdesc"><div class="short">Alias for applyTemplate</div><div class="long">Alias for <a href="output/Ext.Template.html#Ext.Template-applyTemplate" ext:member="applyTemplate" ext:cls="Ext.Template">applyTemplate</a><div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li>void</li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#apply" ext:member="#apply" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-applyTemplate"></a><b><a href="source/Template.html#method-Ext.Template-applyTemplate">applyTemplate</a></b>(&nbsp;<code>Object/Array&nbsp;values</code>&nbsp;)
    :
                                        String<div class="mdesc"><div class="short">Returns an HTML fragment of this template with the specified values applied.</div><div class="long">Returns an HTML fragment of this template with the specified values applied.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li></ul><strong>Returns:</strong><ul><li><code>String</code><div class="sub-desc">The HTML fragment</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#applyTemplate" ext:member="#applyTemplate" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-compile"></a><b><a href="source/Template.html#method-Ext.Template-compile">compile</a></b>()
    :
                                        Ext.Template<div class="mdesc"><div class="short">Compiles the template into an internal function, eliminating the RegEx overhead.</div><div class="long">Compiles the template into an internal function, eliminating the RegEx overhead.<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li><code>Ext.Template</code><div class="sub-desc">this</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#compile" ext:member="#compile" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.MasterTemplate-fill"></a><b><a href="source/MasterTemplate.html#method-Ext.MasterTemplate-fill">fill</a></b>(&nbsp;<span title="Optional" class="optional">[<code>String/Number&nbsp;name</code>]</span>,&nbsp;<code>Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;reset</code>]</span>&nbsp;)
    :
                                        MasterTemplate<div class="mdesc"><div class="short">Applies all the passed values to a child template.</div><div class="long">Applies all the passed values to a child template.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>name</code> : String/Number<div class="sub-desc">(optional) The name or index of the child template</div></li><li><code>values</code> : Array<div class="sub-desc">The values to be applied to the template, this should be an array of objects.</div></li><li><code>reset</code> : Boolean<div class="sub-desc">(optional) True to reset the template first</div></li></ul><strong>Returns:</strong><ul><li><code>MasterTemplate</code><div class="sub-desc">this</div></li></ul></div></div></div></td><td class="msource">MasterTemplate</td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-insertAfter"></a><b><a href="source/Template.html#method-Ext.Template-insertAfter">insertAfter</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
    :
                                        HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and inserts the new node(s) after el.</div><div class="long">Applies the supplied values to the template and inserts the new node(s) after el.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li></ul><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#insertAfter" ext:member="#insertAfter" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-insertBefore"></a><b><a href="source/Template.html#method-Ext.Template-insertBefore">insertBefore</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
    :
                                        HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and inserts the new node(s) before el.</div><div class="long">Applies the supplied values to the template and inserts the new node(s) before el.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li></ul><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#insertBefore" ext:member="#insertBefore" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-insertFirst"></a><b><a href="source/Template.html#method-Ext.Template-insertFirst">insertFirst</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
    :
                                        HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and inserts the new node(s) as the first child of el.</div><div class="long">Applies the supplied values to the template and inserts the new node(s) as the first child of el.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li></ul><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#insertFirst" ext:member="#insertFirst" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-overwrite"></a><b><a href="source/Template.html#method-Ext.Template-overwrite">overwrite</a></b>(&nbsp;<code>Mixed&nbsp;el</code>,&nbsp;<code>Object/Array&nbsp;values</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;returnElement</code>]</span>&nbsp;)
    :
                                        HTMLElement/Ext.Element<div class="mdesc"><div class="short">Applies the supplied values to the template and overwrites the content of el with the new node(s).</div><div class="long">Applies the supplied values to the template and overwrites the content of el with the new node(s).<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>el</code> : Mixed<div class="sub-desc">The context element</div></li><li><code>values</code> : Object/Array<div class="sub-desc">The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})</div></li><li><code>returnElement</code> : Boolean<div class="sub-desc">(optional) true to return a Ext.Element (defaults to undefined)</div></li></ul><strong>Returns:</strong><ul><li><code>HTMLElement/Ext.Element</code><div class="sub-desc">The new node or Element</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#overwrite" ext:member="#overwrite" ext:cls="Ext.Template">Template</a></td></tr><tr class="method-row expandable "><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.MasterTemplate-reset"></a><b><a href="source/MasterTemplate.html#method-Ext.MasterTemplate-reset">reset</a></b>()
    :
                                        MasterTemplate<div class="mdesc"><div class="short">Resets the template for reuse</div><div class="long">Resets the template for reuse<div class="mdetail-params"><strong>Parameters:</strong><ul><li>None.</li></ul><strong>Returns:</strong><ul><li><code>MasterTemplate</code><div class="sub-desc">this</div></li></ul></div></div></div></td><td class="msource">MasterTemplate</td></tr><tr class="method-row expandable inherited"><td class="micon"><a href="#expand" class="exi">&nbsp;</a></td><td class="sig"><a id="Ext.Template-set"></a><b><a href="source/Template.html#method-Ext.Template-set">set</a></b>(&nbsp;<code>String&nbsp;html</code>,&nbsp;<span title="Optional" class="optional">[<code>Boolean&nbsp;compile</code>]</span>&nbsp;)
    :
                                        Ext.Template<div class="mdesc"><div class="short">Sets the HTML used as the template and optionally compiles it.</div><div class="long">Sets the HTML used as the template and optionally compiles it.<div class="mdetail-params"><strong>Parameters:</strong><ul><li><code>html</code> : String<div class="sub-desc"></div></li><li><code>compile</code> : Boolean<div class="sub-desc">(optional) True to compile the template (defaults to undefined)</div></li></ul><strong>Returns:</strong><ul><li><code>Ext.Template</code><div class="sub-desc">this</div></li></ul></div></div></div></td><td class="msource"><a href="output/Ext.Template.html#set" ext:member="#set" ext:cls="Ext.Template">Template</a></td></tr></tbody></table><a id="Ext.MasterTemplate-events"></a><h2>Public Events</h2><div class="no-members">This class has no public events.</div></div>